export const CommonData = [
  {
    databaseName: 'ERP系统数据库',
    databaseDescription: '主库',
    serverDescription: 'ERP系统服务器'
  },
  {
    databaseName: 'HR系统数据库',
    databaseDescription: '主库',
    serverDescription: 'HR系统服务器'
  },
  {
    databaseName: '钻井液专家系统',
    databaseDescription: '主库',
    serverDescription: '钻井液系统服务器'
  },
  {
    databaseName: '钻井液专家系统',
    databaseDescription: '备库',
    serverDescription: '钻井液系统服务器'
  },
  {
    databaseName: '财务系统数据库',
    databaseDescription: '主库',
    serverDescription: '财务系统服务器'
  },
  {
    databaseName: '财务系统数据库',
    databaseDescription: '备库',
    serverDescription: '钻井液系统服务器'
  },
  {
    databaseName: 'HR系统数据库',
    databaseDescription: '备库',
    serverDescription: 'HR系统服务器'
  },
  {
    databaseName: 'ERP系统数据库',
    databaseDescription: '备库',
    serverDescription: 'ERP系统服务器'
  },
  {
    databaseName: 'ERP系统数据库',
    databaseDescription: '备库',
    serverDescription: 'ERP系统服务器'
  }

]

export const people = [
  '黄罡',
  '袁崇',
  '彭源',
  '黎峰',
  '陈文',
  '胡国梁',
  '阮理义',
  '孙杨',
  '博尔特',
  '科比',
  '詹姆斯',
  '邓肯'
]

export const status = [
  '审核中',
  '启用',
  '停用',
  '已下线'
]

export const server = [
  '阿里云',
  '百度云',
  '华为云',
  '本地服务器',
  '本地服务器',
  '本地服务器',
  '本地服务器'
]

export const serverType = [
  'CentOs',
  'Windows',
  'Ubuntu'
]

export const address = [
  '西南集群',
  '上海集群',
  '北京集群',
  '东北集群',
  '成都集群',
  '重庆集群'
]

export const ip = [
  '127.1.0.1',
  '223.33.3.1',
  '179.123.3.33',
  '255.44.55.1',
  '128.123.33.4',
  '220.155.4.1',
  '245.55.45.1',
  '170.69.12.1',
  '177.12.32.111',
  '189.32.43.77'
]

export const form = [
  'EMPLOYEE',
  'CM_WK_FLUIDEVALUE',
  'CM_WK_LOGGING',
  'BA_WELL',
  'BA_WELL_STRUCTURE',
  'CM_WK_MUD_PROPERTY',
  'CM_WK_MUD_FORMULA',
  'CM_WK_WORK_RECORD',
  'CM_WK_ADDITIVE_CONSUME',
  'CM_WK_DRILLING',
  'CM_WK_FLUIDPROPERTY',
  'CM_WK_LOGGING_TEMP',
  'CM_WK_CENTRAPOSITION',
  'CM_WK_TAILCASE_HANGE',
  'CM_WK_CIRCULATION',
  'CM_WK_FLUIDFIRST',
  'CM_WK_FLUIDMIDDLE',
  'CM_WK_FLUIDLAST',
  'CM_WK_DISPLACEDATA',
  'CM_WK_DISPLACE',
  'CM_WK_RETURNFLUID',
  'CM_WK_TAILCLEAR'
]

export const formDescription = [
  '业务表',
  '系统表',
  '辅助表'
]

export function getRandomArray(array) {
  return array[Math.round(Math.random() * (array.length - 1)) ]
}

export function getNumber() {
  return Math.round(Math.random() * 4) + 1
}

export function getTime() {
  return (Math.round(Math.random() * 20) + 2000) + '-' + (Math.round(Math.random() * 11) + 1) + '-' + (Math.round(Math.random() * 29) + 1)
}

export function getIP() {
  return (Math.round(Math.random() * 254) + 1) + '.' + (Math.round(Math.random() * 254) + 1) + '.' + (Math.round(Math.random() * 254) + 1) + '.' + (Math.round(Math.random() * 254) + 1)
}

export function getObject() {
  const length = CommonData.length
  const result = []
  for (let i = 0; i < length; i++) {
    const tmpObject = CommonData[i]
    tmpObject.id = i + 1
    tmpObject.name = getRandomArray(people)
    tmpObject.status = getRandomArray(status)
    tmpObject.number = getNumber()
    tmpObject.number1 = getNumber()
    tmpObject.number2 = getNumber()
    tmpObject.time = getTime()
    tmpObject.server = getRandomArray(server)
    tmpObject.serverType = getRandomArray(serverType)
    tmpObject.database = Math.random() < 0.5 ? 'MYSQL' : 'ORACLE'
    tmpObject.form = getRandomArray(form)
    tmpObject.address = getRandomArray(address)
    tmpObject.ip = getIP()
    tmpObject.formDescription = getRandomArray(formDescription)
    result.push(tmpObject)
  }
  return result
}
